//
//  HMDocoterViewController.m
//  HomeView
//
//  Created by manman on 16/9/9.
//  Copyright © 2016年 manman. All rights reserved.
//

#import "HMDocoterViewController.h"
#import "YYModel.h"
#import "NSObject+YYModel.h"
#import "HMDocModel.h"
#import "HMDocListCell.h"
//#import "HMHomeController.h"
static NSString *cellID = @"cellID";
@interface HMDocoterViewController ()
@property(strong,nonatomic)NSArray *modelsArr;
@end

@implementation HMDocoterViewController
- (instancetype)init
{
    if(self = [super init]){
        [self loadData];
    self.tableView.rowHeight = 100;
    self.title = @"医生";
    //    self.navigationController.navigationBarHidden = NO;
//    UIBarButtonItem *backBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(backClick:)];
//    self.navigationItem.leftBarButtonItem = backBtn;
//    UIBarButtonItem *goToHome = [[UIBarButtonItem alloc]initWithTitle:@"首页" style:UIBarButtonItemStylePlain target:self action:@selector(homeClick:)];
//    self.navigationItem.rightBarButtonItem = goToHome;
    
   
    [self.tableView registerNib:[UINib nibWithNibName:@"HMDocListCell" bundle:nil] forCellReuseIdentifier:cellID];
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//-(void)backClick:(UIBarButtonItem *)btn
//{
//
//    [self.navigationController popViewControllerAnimated:YES];
//    self.navigationController.navigationBarHidden = YES;
//
//
//}
//- (void)homeClick:(UIBarButtonItem *)btn
//{
//    HMHomeController *home = [[HMHomeController alloc]init];
//    [self.navigationController pushViewController:home animated:NO];
//
//
//
//
//}

#pragma mark - Table view data source


   
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return _modelsArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    HMDocListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
    cell.model = self.modelsArr[indexPath.row];
    return cell;


}


//加载数据
- (void)loadData
{
//URL
    //解析plist文件
    NSString *path = [[NSBundle mainBundle] pathForResource:@"Consultation.plist" ofType:nil];
    NSArray *arr = [NSArray arrayWithContentsOfFile:path];
    self.modelsArr = [NSArray yy_modelArrayWithClass:[HMDocModel class] json:arr];
}
@end
